{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Introduction to atomman: LAMMPS Potentials\n",
    "\n",
    "__Lucas M. Hale__, [lucas.hale@nist.gov](mailto:lucas.hale@nist.gov?Subject=ipr-demo), _Materials Science and Engineering Division, NIST_.\n",
    "    \n",
    "[Disclaimers](http://www.nist.gov/public_affairs/disclaimer.cfm)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "__Table of contents__\n",
    "\n",
    "1. [Introduction](#section1) \n",
    "2. [Loading LAMMPS Potentials](#section2)\n",
    "3. [Potential Classes](#section3)\n",
    "4. [User-Defined Potentials](#section4)\n",
    "5. [potential_LAMMPS Data Model](#section5)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1. Introduction <a id='section1'></a>\n",
    "\n",
    "The atomman package is designed to interact with LAMMPS-compatible interatomic potential implementations and assist with the automatic and dynamic generation of the associated LAMMPS command lines.  Starting with atomman version 1.3.3, the main management of LAMMPS potentials is now handled with the [potentials package](https://github.com/usnistgov/potentials), with atomman inheriting classes for representing LAMMPS potentials and accessing database records from the NIST Interatomic Potentials Repository. These methods allow for pre-defined potentials to be retrieved either from the [remote database potentials.nist.gov](https://potentials.nist.gov/) or from a local directory, and for user-defined potentials to be easily integrated in with the official ones."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Library Imports**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "atomman version = 1.4.0\n",
      "Notebook executed on 2021-08-05\n"
     ]
    }
   ],
   "source": [
    "# Standard libraries\n",
    "from pathlib import Path\n",
    "import datetime\n",
    "\n",
    "# http://www.numpy.org/\n",
    "import numpy as np             \n",
    "\n",
    "# https://github.com/usnistgov/atomman\n",
    "import atomman as am            \n",
    "import atomman.lammps as lmp\n",
    "import atomman.unitconvert as uc\n",
    "\n",
    "# Show atomman version\n",
    "print('atomman version =', am.__version__)\n",
    "\n",
    "# Show date of Notebook execution\n",
    "print('Notebook executed on', datetime.date.today())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2. Loading LAMMPS Potentials <a id='section2'></a>\n",
    "\n",
    "\n",
    "### 2.1. Using load_lammps_potential()\n",
    "\n",
    "*Added version 1.3.3*\n",
    "\n",
    "*Updated version 1.4.0* for potentials package version 0.3.0\n",
    "\n",
    "The function atomman.load_lammps_potential() allows for a LAMMPS potential to be loaded from the potentials database. Depending on the settings used, this function will search for matching potentials from the local database copy and/or potentials.nist.gov.\n",
    "\n",
    "Search parameters\n",
    "    \n",
    "- __name__ (*str or list*) The record name(s) to parse by.  For potential records, the names should correspond to the id with a prefix of \"potentials.\" added to it.\n",
    "- __key__ (*str or list*) The unique UUID4 record key(s) to parse by. \n",
    "- __id__ (*str or list*) The unique record id(s) labeling the records to parse by.\n",
    "- __potid__ (*str or list*) The unique UUID4 record key(s) for the associated potential records to parse by.\n",
    "- __potkey__ (*str or list*) The unique record id(s) labeling the associated potential records to parse by.\n",
    "- __units__ (*str or list*) LAMMPS units option(s) to parse by.\n",
    "- __atom_style__ (*str or list*) LAMMPS pair_style(s) to parse by.\n",
    "- __pair_style__ (*str or list*) LAMMPS pair_style(s) to parse by.\n",
    "- __status__ (*None, str or list*) Limits the search by the status of the LAMMPS implementations: \"active\", \"superseded\" and/or \"retracted\".  By default, only active implementations are returned.  Giving a value of None will return implementations of all statuses.\n",
    "- __symbols__ (*str or list*) Model symbol(s) to parse by.  Typically correspond to elements for atomic potential models.\n",
    "- __elements__ (*str or list*) Element(s) in the model to parse by.\n",
    "\n",
    "Database settings\n",
    "\n",
    "- __database__ (*atomman.library.Database, optional*) Allows for a previously defined Database object to be used to find the potential.  If not given, a new Database object will be used with the default local and remote interaction settings.\n",
    "- __local__ (*bool, optional*) Indicates if the local location is to be searched.  Default value matches the value set when the database was initialized.\n",
    "- __remote__ (*bool, optional*) Indicates if the remote location is to be searched.  Default value matches the value set when the database was initialized.\n",
    "- __kim_models__ (*list*) A list of full KIM model ids to build LAMMPS potentials for.\n",
    "- __kim_api_directory__ (*str*) The path to the directory containing a kim-api-collections-management executable to use to identify which KIM models are installed.\n",
    "- __kim_models_file__ (*str*) The path to a file containing a list of full KIM model ids to build LAMMPS potentials for.\n",
    "        \n",
    "Other options\n",
    "\n",
    "- __pot_dir_stylee__ (*str, optional*) Specifies how the pot_dir values will be set for the retrieved LAMMPS potentials.  Allowed values are 'working', 'id', and 'local'. \n",
    "    - 'working' will set all pot_dir = '', meaning parameter files are expected in the working directory when the potential is accessed. \n",
    "    - 'id' sets the pot_dir values to match the potential's id. \n",
    "    - 'local' sets the pot_dir values to the corresponding local database paths where the files are expected to be found.  Default value is controlled by settings.\n",
    "- __getfilese__ (*bool, optional*) If True, then the parameter files for the matching potentials will also be copied/downloaded to the potential directory.\n",
    "- __prompte__ (*bool*) If prompt=True (default) then a screen input will ask for a selection if multiple matching potentials are found.  If prompt=False, then an error will be thrown if multiple matches are found.\n",
    "- __verbosee__ (*bool, optional*) If True, info messages will be printed during operations.  Default value is False.\n",
    "\n",
    "Returns\n",
    "\n",
    "- (*potentials.PotentialLAMMPS*) The potential object to use.\n",
    "\n",
    "\n",
    "    \n",
    "    \n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2.1.1. By id\n",
    "\n",
    "Each LAMMPS potential in the NIST Interatomic Potentials Repository has a unique id that indicates the associated publication, what the model represents, and which archived version it is for. These id's can be easily found by either searching for potentials using\n",
    "\n",
    "- [Interatomic Potentials Repository](https://www.ctcms.nist.gov/potentials) and finding the ids for the LAMMPS versions you want to use - the id's in parenthesis that contain \"LAMMPS\" within them.\n",
    "- [potentials.nist.gov](https://potentials.nist.gov/explore/keyword/) and in the \"Filter by Template\" section on the left clicking the box next to potential_LAMMPS and/or potential_LAMMPS_KIM.\n",
    "- [atomman.library.Database](1.5._Settings_and_databases.html) (and section 2.2 below) provides additional methods for searching and exploring the hosted potentials from within Python."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "potential_LAMMPS record named 1989--Adams-J-B--Ni--LAMMPS--ipr1\n"
     ]
    }
   ],
   "source": [
    "potential = am.load_lammps_potential(id='1989--Adams-J-B--Ni--LAMMPS--ipr1')\n",
    "print(potential)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Note that by default the function will only return currently active versions of LAMMPS potentials, so older versions that have been marked as \"superseded\" or \"retracted\" won't show.  Setting the status parameter to None will allow for the old versions to be retrieved. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\lmh1\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\pandas\\core\\ops\\__init__.py:1115: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison\n",
      "  result = method(y)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ValueError: No matching LAMMPS potentials found\n"
     ]
    }
   ],
   "source": [
    "# Old LAMMPS version won't be found because it is not \"active\"\n",
    "try:\n",
    "    potential = am.load_lammps_potential(id='2004--Zhou-X-W--Ni--LAMMPS--ipr1')\n",
    "except Exception as ex:\n",
    "    print(f'{type(ex).__name__}: {ex.args[0]}')\n",
    "else:\n",
    "    print(potential)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "potential_LAMMPS record named 2004--Zhou-X-W--Ni--LAMMPS--ipr1\n"
     ]
    }
   ],
   "source": [
    "# Setting status=None allows for the old version to be retrieved\n",
    "try:\n",
    "    potential = am.load_lammps_potential(id='2004--Zhou-X-W--Ni--LAMMPS--ipr1', status=None)\n",
    "except Exception as ex:\n",
    "    print(f'{type(ex).__name__}: {ex.args[0]}')\n",
    "else:\n",
    "    print(potential)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2.1.2. By potid\n",
    "\n",
    "You can also search using the potential model id - the main identifier for potentials on the Interatomic Potentials Reporitory - using the potid parameter.  If there is more than one \"active\" version of the potential, then a prompt list will appear. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Multiple matching record retrieved from local\n",
      "1 2004--Zhou-X-W--Ni--LAMMPS--ipr2\n",
      "2 EAM_Dynamo_ZhouJohnsonWadley_2004_Ni__MO_110256178378_005\n",
      "3 EAM_Dynamo_ZhouWadleyJohnson_2001NISTretabulation_Ni__MO_593762436933_000\n"
     ]
    },
    {
     "name": "stdin",
     "output_type": "stream",
     "text": [
      "Please select one: 1\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "potential_LAMMPS record named 2004--Zhou-X-W--Ni--LAMMPS--ipr2\n"
     ]
    }
   ],
   "source": [
    "potential = am.load_lammps_potential(potid='2004--Zhou-X-W-Johnson-R-A-Wadley-H-N-G--Ni')\n",
    "print(potential)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2.1.3. By category\n",
    "\n",
    "The LAMMPS potentials can also be (partially) explored by using the pair_style, elements, and symbols parameters.  For elements vs. symbols\n",
    "\n",
    "- elements are the specific elements that potentials for modeling atoms are representing. A model may not be associated with an element if it is a meta or coarse-grain model.\n",
    "- symbols are the model names for each unique interaction. For atomic models, this is usually the same as elements but can differ if multiple models for the same element are part of the same potential.   "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Multiple matching record retrieved from local\n",
      "1 1985--Foiles-S-M--Ni-Cu--LAMMPS--ipr1\n",
      "2 1986--Foiles-S-M--Ag-Au-Cu-Ni-Pd-Pt--LAMMPS--ipr1\n",
      "3 1986--Foiles-S-M--Ni--LAMMPS--ipr1\n",
      "4 1987--Ackland-G-J--Ni--LAMMPS--ipr1\n",
      "5 1987--Ackland-G-J--Ni--LAMMPS--ipr2\n",
      "6 1989--Adams-J-B--Ag-Au-Cu-Ni-Pd-Pt--LAMMPS--ipr1\n",
      "7 1989--Adams-J-B--Ni--LAMMPS--ipr1\n",
      "8 1995--Angelo-J-E--Ni-Al-H--LAMMPS--ipr1\n",
      "9 1999--Mishin-Y--Ni--LAMMPS--ipr1\n",
      "10 2002--Mishin-Y--Ni-Al--LAMMPS--ipr1\n",
      "11 2004--Mishin-Y--Ni-Al--LAMMPS--ipr1\n",
      "12 2004--Mishin-Y--Ni-Al--LAMMPS--ipr2\n",
      "13 2004--Zhou-X-W--Ni--LAMMPS--ipr2\n",
      "14 2009--Bonny-G--Fe-Cu-Ni--LAMMPS--ipr1\n",
      "15 2009--Bonny-G--Fe-Ni--LAMMPS--ipr1\n",
      "16 2009--Purja-Pun-G-P--Ni-Al--LAMMPS--ipr1\n",
      "17 2011--Bonny-G--Fe-Ni-Cr--LAMMPS--ipr1\n",
      "18 2011--Bonny-G--Fe-Ni-Cr--LAMMPS--ipr2\n",
      "19 2012--Mendelev-M-I--Ni--LAMMPS--ipr1\n",
      "20 2012--Mendelev-M-I--Ni-Zr--LAMMPS--ipr1\n",
      "21 2013--Bonny-G--Fe-Ni-Cr--LAMMPS--ipr1\n",
      "22 2013--Onat-B--Cu-Ni--LAMMPS--ipr2\n",
      "23 2015--Purja-Pun-G-P--Ni-Al-Co--LAMMPS--ipr2\n",
      "24 2015--Purja-Pun-G-P--Ni-Co--LAMMPS--ipr2\n",
      "25 2015--Wilson-S-R--Ni-Zr--LAMMPS--ipr1\n",
      "26 2016--Beland-L-K--Ni-Co--LAMMPS--ipr1\n",
      "27 2016--Samolyuk-G-D--Ni-Pd--LAMMPS--ipr1\n",
      "28 2016--Stoller-R-E--Ni--LAMMPS--ipr1\n",
      "29 2016--Zhang-Y--Ni-Nb--LAMMPS--ipr1\n",
      "30 2017--Beland-L-K--Fe-Ni-Cr--LAMMPS--ipr1\n",
      "31 2018--Farkas-D--Fe-Ni-Cr-Co-Cu--LAMMPS--ipr2\n",
      "32 2018--Pan-Z--Ag-Ni--LAMMPS--ipr1\n",
      "33 2018--Zhou-X-W--Fe-Ni-Cr--LAMMPS--ipr1\n",
      "34 2018--Zhou-X-W--Fe-Ni-Cr--LAMMPS--ipr2\n",
      "35 2019--Fischer-F--Cu-Ni--LAMMPS--ipr1\n",
      "36 2019--Fischer-F--Cu-Ni--LAMMPS--ipr2\n",
      "37 2019--Fischer-F--Cu-Ni--LAMMPS--ipr3\n",
      "38 2019--Mendelev-M-I--Fe-Ni-Cr--LAMMPS--ipr1\n",
      "39 2020--Farkas-D--Fe-Ni-Cr-Co-Al--LAMMPS--ipr1\n",
      "40 2021--Deluigi-O-R--Fe-Ni-Cr-Co-Cu--LAMMPS--ipr1\n"
     ]
    },
    {
     "name": "stdin",
     "output_type": "stream",
     "text": [
      "Please select one: 10\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "potential_LAMMPS record named 2002--Mishin-Y--Ni-Al--LAMMPS--ipr1\n"
     ]
    }
   ],
   "source": [
    "# Select an eam-style potential for Ni\n",
    "potential = am.load_lammps_potential(pair_style=['eam', 'eam/alloy', 'eam/fs'], elements='Ni')\n",
    "print(potential)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.2. Using Database class\n",
    "\n",
    "*Added version 1.3.3*\n",
    "\n",
    "*Updated version 1.4.0* for potentials package version 0.3.0 changes.\n",
    "\n",
    "More involved searches can be performed using the atomman.library.Database class.  This class inherits from [potentials.Database](https://github.com/lmhale99/potentials/blob/master/doc/4.%20Database%20Class.html) and has all of the methods for exploring the potentials and LAMMPS potentials entries as the parent class."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Found 411 matching potential_LAMMPS records in local library\n",
      "Found 408 matching potential_LAMMPS records in remote library\n",
      " - 0 remote records are new\n",
      "Found 450 matching potential_LAMMPS_KIM records in local library\n",
      "Found 450 matching potential_LAMMPS_KIM records in remote library\n",
      " - 0 remote records are new\n",
      "Built 302 lammps potentials for KIM models\n",
      "The first loaded LAMMPS potential is potential_LAMMPS record named 1985--Foiles-S-M--Ni-Cu--LAMMPS--ipr1\n"
     ]
    }
   ],
   "source": [
    "potdb = am.library.Database()\n",
    "lammps_potentials, lammps_potentials_df = potdb.get_lammps_potentials(return_df=True, verbose=True)\n",
    "print('The first loaded LAMMPS potential is', lammps_potentials[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>id</th>\n",
       "      <th>key</th>\n",
       "      <th>potid</th>\n",
       "      <th>potkey</th>\n",
       "      <th>units</th>\n",
       "      <th>atom_style</th>\n",
       "      <th>allsymbols</th>\n",
       "      <th>pair_style</th>\n",
       "      <th>status</th>\n",
       "      <th>symbols</th>\n",
       "      <th>elements</th>\n",
       "      <th>artifacts</th>\n",
       "      <th>comments</th>\n",
       "      <th>dois</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>0</td>\n",
       "      <td>1985--Foiles-S-M--Ni-Cu--LAMMPS--ipr1</td>\n",
       "      <td>1985--Foiles-S-M--Ni-Cu--LAMMPS--ipr1</td>\n",
       "      <td>062d2ba7-3903-40ae-a772-daa471d107c6</td>\n",
       "      <td>1985--Foiles-S-M--Ni-Cu</td>\n",
       "      <td>301f04ce-9082-4542-8590-489300cd19e8</td>\n",
       "      <td>metal</td>\n",
       "      <td>atomic</td>\n",
       "      <td>0</td>\n",
       "      <td>eam</td>\n",
       "      <td>active</td>\n",
       "      <td>[Cu, Ni]</td>\n",
       "      <td>[Cu, Ni]</td>\n",
       "      <td>[{'filename': 'Cu_smf7.eam', 'label': None, 'u...</td>\n",
       "      <td>Potential 1985--Foiles-S-M--Ni-Cu--LAMMPS--ipr...</td>\n",
       "      <td>[10.1103/physrevb.32.7685]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>1</td>\n",
       "      <td>1985--Stillinger-F-H--Si--LAMMPS--ipr1</td>\n",
       "      <td>1985--Stillinger-F-H--Si--LAMMPS--ipr1</td>\n",
       "      <td>d085648c-b3ef-4be8-824b-7093fd22770a</td>\n",
       "      <td>1985--Stillinger-F-H-Weber-T-A--Si</td>\n",
       "      <td>edc31ad6-2b9a-455c-9b5f-e888a672ecbd</td>\n",
       "      <td>metal</td>\n",
       "      <td>atomic</td>\n",
       "      <td>0</td>\n",
       "      <td>sw</td>\n",
       "      <td>active</td>\n",
       "      <td>[Si]</td>\n",
       "      <td>[Si]</td>\n",
       "      <td>[{'filename': 'Si.sw', 'label': None, 'url': '...</td>\n",
       "      <td>Potential 1985--Stillinger-F-H--Si--LAMMPS--ip...</td>\n",
       "      <td>[10.1103/physrevb.31.5262, 10.1103/physrevb.33...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2</td>\n",
       "      <td>1986--Foiles-S-M--Ag--LAMMPS--ipr1</td>\n",
       "      <td>1986--Foiles-S-M--Ag--LAMMPS--ipr1</td>\n",
       "      <td>76a265fc-45ff-49d7-8c64-2044f12402f2</td>\n",
       "      <td>1986--Foiles-S-M-Baskes-M-I-Daw-M-S--Ag</td>\n",
       "      <td>672d54f8-9f48-4200-af56-8a7378ebbc4a</td>\n",
       "      <td>metal</td>\n",
       "      <td>atomic</td>\n",
       "      <td>0</td>\n",
       "      <td>eam</td>\n",
       "      <td>active</td>\n",
       "      <td>[Ag]</td>\n",
       "      <td>[Ag]</td>\n",
       "      <td>[{'filename': 'Ag_u3.eam', 'label': None, 'url...</td>\n",
       "      <td>Potential 1986--Foiles-S-M--Ag--LAMMPS--ipr1 l...</td>\n",
       "      <td>[10.1103/physrevb.33.7983]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>3</td>\n",
       "      <td>1986--Foiles-S-M--Ag-Au-Cu-Ni-Pd-Pt--LAMMPS--ipr1</td>\n",
       "      <td>1986--Foiles-S-M--Ag-Au-Cu-Ni-Pd-Pt--LAMMPS--ipr1</td>\n",
       "      <td>c5afa7e8-6b3b-49cd-ad1c-ae3e4329363a</td>\n",
       "      <td>1986--Foiles-S-M-Baskes-M-I-Daw-M-S--Ag-Au-Cu-...</td>\n",
       "      <td>7a1302de-59cf-4efb-900e-cad845b68ee5</td>\n",
       "      <td>metal</td>\n",
       "      <td>atomic</td>\n",
       "      <td>0</td>\n",
       "      <td>eam</td>\n",
       "      <td>active</td>\n",
       "      <td>[Ag, Au, Cu, Ni, Pd, Pt]</td>\n",
       "      <td>[Ag, Au, Cu, Ni, Pd, Pt]</td>\n",
       "      <td>[{'filename': 'Ag_u3.eam', 'label': None, 'url...</td>\n",
       "      <td>Potential 1986--Foiles-S-M--Ag-Au-Cu-Ni-Pd-Pt-...</td>\n",
       "      <td>[10.1103/physrevb.33.7983]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>4</td>\n",
       "      <td>1986--Foiles-S-M--Au--LAMMPS--ipr1</td>\n",
       "      <td>1986--Foiles-S-M--Au--LAMMPS--ipr1</td>\n",
       "      <td>c588810a-b96d-4871-bfe2-cff8a5a7c709</td>\n",
       "      <td>1986--Foiles-S-M-Baskes-M-I-Daw-M-S--Au</td>\n",
       "      <td>ffb66faa-319d-4556-8363-dad3959cd553</td>\n",
       "      <td>metal</td>\n",
       "      <td>atomic</td>\n",
       "      <td>0</td>\n",
       "      <td>eam</td>\n",
       "      <td>active</td>\n",
       "      <td>[Au]</td>\n",
       "      <td>[Au]</td>\n",
       "      <td>[{'filename': 'Au_u3.eam', 'label': None, 'url...</td>\n",
       "      <td>Potential 1986--Foiles-S-M--Au--LAMMPS--ipr1 l...</td>\n",
       "      <td>[10.1103/physrevb.33.7983]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>708</td>\n",
       "      <td>MO_987541074959</td>\n",
       "      <td>EMT_Asap_MetalGlass_PaduraruKenoufiBailey_2007...</td>\n",
       "      <td>ae436ece-e774-4a52-a2ad-5fdca0d7cc11</td>\n",
       "      <td>2007--Paduraru-A-Kenoufi-A-Bailey-N-P-Schiotz-...</td>\n",
       "      <td>d05c1f39-89ef-47c7-b263-7bf0145b36ac</td>\n",
       "      <td>metal</td>\n",
       "      <td>atomic</td>\n",
       "      <td>0</td>\n",
       "      <td>kim</td>\n",
       "      <td>active</td>\n",
       "      <td>[]</td>\n",
       "      <td>[]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>709</td>\n",
       "      <td>MO_988703794028</td>\n",
       "      <td>EAM_Dynamo_ZhouWadleyJohnson_2001NISTretabulat...</td>\n",
       "      <td>0cf56710-0492-4b36-b2ca-a01dac5db5ba</td>\n",
       "      <td>2004--Zhou-X-W-Johnson-R-A-Wadley-H-N-G--Pb</td>\n",
       "      <td>1c592eb1-3cdd-4090-aa0b-e7246f7d5f91</td>\n",
       "      <td>metal</td>\n",
       "      <td>atomic</td>\n",
       "      <td>0</td>\n",
       "      <td>kim</td>\n",
       "      <td>active</td>\n",
       "      <td>[]</td>\n",
       "      <td>[]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>710</td>\n",
       "      <td>MO_993644691224</td>\n",
       "      <td>EAM_Dynamo_ZhouWadleyJohnson_2001NISTretabulat...</td>\n",
       "      <td>2b10dcab-b59a-44b8-93e4-470f33f987c0</td>\n",
       "      <td>2004--Zhou-X-W-Johnson-R-A-Wadley-H-N-G--Pd</td>\n",
       "      <td>5ea5dd6c-a901-4acd-b036-9c33a0acd5b0</td>\n",
       "      <td>metal</td>\n",
       "      <td>atomic</td>\n",
       "      <td>0</td>\n",
       "      <td>kim</td>\n",
       "      <td>active</td>\n",
       "      <td>[]</td>\n",
       "      <td>[]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>711</td>\n",
       "      <td>MO_995724792024</td>\n",
       "      <td>LJ_Shifted_Bernardes_1958LowCutoff_Kr__MO_9957...</td>\n",
       "      <td>be07eb49-d6fd-4677-8a6a-6ee6a764fbac</td>\n",
       "      <td>1958--Bernardes-N--Kr</td>\n",
       "      <td>e62cbc12-99ba-469b-8d4e-e26ad40cb15a</td>\n",
       "      <td>metal</td>\n",
       "      <td>atomic</td>\n",
       "      <td>0</td>\n",
       "      <td>kim</td>\n",
       "      <td>active</td>\n",
       "      <td>[]</td>\n",
       "      <td>[]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>712</td>\n",
       "      <td>MO_999639780744</td>\n",
       "      <td>Morse_Shifted_GirifalcoWeizer_1959MedCutoff_Cs...</td>\n",
       "      <td>a6b1f0b6-f679-4354-9743-1aea1af29a52</td>\n",
       "      <td>1959--Girifalco-L-A-Weizer-V-G--Cs</td>\n",
       "      <td>8d561d50-26d9-43d6-822a-e95a4be93436</td>\n",
       "      <td>metal</td>\n",
       "      <td>atomic</td>\n",
       "      <td>0</td>\n",
       "      <td>kim</td>\n",
       "      <td>active</td>\n",
       "      <td>[]</td>\n",
       "      <td>[]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>713 rows × 15 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                  name  \\\n",
       "0                1985--Foiles-S-M--Ni-Cu--LAMMPS--ipr1   \n",
       "1               1985--Stillinger-F-H--Si--LAMMPS--ipr1   \n",
       "2                   1986--Foiles-S-M--Ag--LAMMPS--ipr1   \n",
       "3    1986--Foiles-S-M--Ag-Au-Cu-Ni-Pd-Pt--LAMMPS--ipr1   \n",
       "4                   1986--Foiles-S-M--Au--LAMMPS--ipr1   \n",
       "..                                                 ...   \n",
       "708                                    MO_987541074959   \n",
       "709                                    MO_988703794028   \n",
       "710                                    MO_993644691224   \n",
       "711                                    MO_995724792024   \n",
       "712                                    MO_999639780744   \n",
       "\n",
       "                                                    id  \\\n",
       "0                1985--Foiles-S-M--Ni-Cu--LAMMPS--ipr1   \n",
       "1               1985--Stillinger-F-H--Si--LAMMPS--ipr1   \n",
       "2                   1986--Foiles-S-M--Ag--LAMMPS--ipr1   \n",
       "3    1986--Foiles-S-M--Ag-Au-Cu-Ni-Pd-Pt--LAMMPS--ipr1   \n",
       "4                   1986--Foiles-S-M--Au--LAMMPS--ipr1   \n",
       "..                                                 ...   \n",
       "708  EMT_Asap_MetalGlass_PaduraruKenoufiBailey_2007...   \n",
       "709  EAM_Dynamo_ZhouWadleyJohnson_2001NISTretabulat...   \n",
       "710  EAM_Dynamo_ZhouWadleyJohnson_2001NISTretabulat...   \n",
       "711  LJ_Shifted_Bernardes_1958LowCutoff_Kr__MO_9957...   \n",
       "712  Morse_Shifted_GirifalcoWeizer_1959MedCutoff_Cs...   \n",
       "\n",
       "                                      key  \\\n",
       "0    062d2ba7-3903-40ae-a772-daa471d107c6   \n",
       "1    d085648c-b3ef-4be8-824b-7093fd22770a   \n",
       "2    76a265fc-45ff-49d7-8c64-2044f12402f2   \n",
       "3    c5afa7e8-6b3b-49cd-ad1c-ae3e4329363a   \n",
       "4    c588810a-b96d-4871-bfe2-cff8a5a7c709   \n",
       "..                                    ...   \n",
       "708  ae436ece-e774-4a52-a2ad-5fdca0d7cc11   \n",
       "709  0cf56710-0492-4b36-b2ca-a01dac5db5ba   \n",
       "710  2b10dcab-b59a-44b8-93e4-470f33f987c0   \n",
       "711  be07eb49-d6fd-4677-8a6a-6ee6a764fbac   \n",
       "712  a6b1f0b6-f679-4354-9743-1aea1af29a52   \n",
       "\n",
       "                                                 potid  \\\n",
       "0                              1985--Foiles-S-M--Ni-Cu   \n",
       "1                   1985--Stillinger-F-H-Weber-T-A--Si   \n",
       "2              1986--Foiles-S-M-Baskes-M-I-Daw-M-S--Ag   \n",
       "3    1986--Foiles-S-M-Baskes-M-I-Daw-M-S--Ag-Au-Cu-...   \n",
       "4              1986--Foiles-S-M-Baskes-M-I-Daw-M-S--Au   \n",
       "..                                                 ...   \n",
       "708  2007--Paduraru-A-Kenoufi-A-Bailey-N-P-Schiotz-...   \n",
       "709        2004--Zhou-X-W-Johnson-R-A-Wadley-H-N-G--Pb   \n",
       "710        2004--Zhou-X-W-Johnson-R-A-Wadley-H-N-G--Pd   \n",
       "711                              1958--Bernardes-N--Kr   \n",
       "712                 1959--Girifalco-L-A-Weizer-V-G--Cs   \n",
       "\n",
       "                                   potkey  units atom_style  allsymbols  \\\n",
       "0    301f04ce-9082-4542-8590-489300cd19e8  metal     atomic           0   \n",
       "1    edc31ad6-2b9a-455c-9b5f-e888a672ecbd  metal     atomic           0   \n",
       "2    672d54f8-9f48-4200-af56-8a7378ebbc4a  metal     atomic           0   \n",
       "3    7a1302de-59cf-4efb-900e-cad845b68ee5  metal     atomic           0   \n",
       "4    ffb66faa-319d-4556-8363-dad3959cd553  metal     atomic           0   \n",
       "..                                    ...    ...        ...         ...   \n",
       "708  d05c1f39-89ef-47c7-b263-7bf0145b36ac  metal     atomic           0   \n",
       "709  1c592eb1-3cdd-4090-aa0b-e7246f7d5f91  metal     atomic           0   \n",
       "710  5ea5dd6c-a901-4acd-b036-9c33a0acd5b0  metal     atomic           0   \n",
       "711  e62cbc12-99ba-469b-8d4e-e26ad40cb15a  metal     atomic           0   \n",
       "712  8d561d50-26d9-43d6-822a-e95a4be93436  metal     atomic           0   \n",
       "\n",
       "    pair_style  status                   symbols                  elements  \\\n",
       "0          eam  active                  [Cu, Ni]                  [Cu, Ni]   \n",
       "1           sw  active                      [Si]                      [Si]   \n",
       "2          eam  active                      [Ag]                      [Ag]   \n",
       "3          eam  active  [Ag, Au, Cu, Ni, Pd, Pt]  [Ag, Au, Cu, Ni, Pd, Pt]   \n",
       "4          eam  active                      [Au]                      [Au]   \n",
       "..         ...     ...                       ...                       ...   \n",
       "708        kim  active                        []                        []   \n",
       "709        kim  active                        []                        []   \n",
       "710        kim  active                        []                        []   \n",
       "711        kim  active                        []                        []   \n",
       "712        kim  active                        []                        []   \n",
       "\n",
       "                                             artifacts  \\\n",
       "0    [{'filename': 'Cu_smf7.eam', 'label': None, 'u...   \n",
       "1    [{'filename': 'Si.sw', 'label': None, 'url': '...   \n",
       "2    [{'filename': 'Ag_u3.eam', 'label': None, 'url...   \n",
       "3    [{'filename': 'Ag_u3.eam', 'label': None, 'url...   \n",
       "4    [{'filename': 'Au_u3.eam', 'label': None, 'url...   \n",
       "..                                                 ...   \n",
       "708                                                NaN   \n",
       "709                                                NaN   \n",
       "710                                                NaN   \n",
       "711                                                NaN   \n",
       "712                                                NaN   \n",
       "\n",
       "                                              comments  \\\n",
       "0    Potential 1985--Foiles-S-M--Ni-Cu--LAMMPS--ipr...   \n",
       "1    Potential 1985--Stillinger-F-H--Si--LAMMPS--ip...   \n",
       "2    Potential 1986--Foiles-S-M--Ag--LAMMPS--ipr1 l...   \n",
       "3    Potential 1986--Foiles-S-M--Ag-Au-Cu-Ni-Pd-Pt-...   \n",
       "4    Potential 1986--Foiles-S-M--Au--LAMMPS--ipr1 l...   \n",
       "..                                                 ...   \n",
       "708                                                NaN   \n",
       "709                                                NaN   \n",
       "710                                                NaN   \n",
       "711                                                NaN   \n",
       "712                                                NaN   \n",
       "\n",
       "                                                  dois  \n",
       "0                           [10.1103/physrevb.32.7685]  \n",
       "1    [10.1103/physrevb.31.5262, 10.1103/physrevb.33...  \n",
       "2                           [10.1103/physrevb.33.7983]  \n",
       "3                           [10.1103/physrevb.33.7983]  \n",
       "4                           [10.1103/physrevb.33.7983]  \n",
       "..                                                 ...  \n",
       "708                                                NaN  \n",
       "709                                                NaN  \n",
       "710                                                NaN  \n",
       "711                                                NaN  \n",
       "712                                                NaN  \n",
       "\n",
       "[713 rows x 15 columns]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lammps_potentials_df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.3. From data model\n",
    "\n",
    "*Updated version 1.4.0* - atomman.lammps.Potential() is now a wrapper that returns either a potentials.record.PotentialLAMMPS or a potentials.record.PotentialLAMMPSKIM object.\n",
    "\n",
    "Potentials can also be directly loaded from a potential_LAMMPS data model record using atomman.lammps.Potential().  The data models can exist as Python dictionaries or be represented in JSON/XML formatted strings or files.  \n",
    "\n",
    "Parameters\n",
    "\n",
    "- __model__ (*DataModelDict, str, or file-like object*) A JSON/XML data model containing a potential-LAMMPS or a potential-LAMMPS-KIM branch.\n",
    "- __name__ (*str, optional*) The record name to use.  If not given, this will be set to the potential's id.\n",
    "- __pot_dir__ (*str, optional*) The path to a directory containing any artifacts associated with the potential.  Default value is None, which assumes any required files will be in the working directory when LAMMPS is executed.\n",
    "- __kim_id__ (*str, optional*) The full KIM model id indicating the version of a KIM model to use. If not given, then the newest known version will be used.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This is a demonstration data model record for an eam/alloy style potential.  NOT A REAL RECORD!\n",
    "\n",
    "- See [Section 4](#section4) for tools to build the data models for most common LAMMPS pair_styles\n",
    "- See [Section 5](#section5) for specific details on the data model record schema and examples."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Define data model record in JSON format\n",
    "eam_alloy_json = \"\"\"{\n",
    "    \"potential-LAMMPS\": {\n",
    "        \"key\": \"a45a7731-d115-4079-b6f5-aa700c5b5c56\",\n",
    "        \"id\": \"EAM-demo--LAMMPS--v1\",\n",
    "        \"potential\": {\n",
    "            \"key\": \"820738a9-f556-468b-9041-9d98351ff751\",\n",
    "            \"id\": \"EAM-demo\"\n",
    "        },\n",
    "        \"units\": \"metal\",\n",
    "        \"atom_style\": \"atomic\",\n",
    "        \"atom\": [\n",
    "            {\n",
    "                \"element\": \"Ni\",\n",
    "                \"mass\": 58.6934\n",
    "            },\n",
    "            {\n",
    "                \"element\": \"Al\",\n",
    "                \"mass\": 26.981539\n",
    "            },\n",
    "            {\n",
    "                \"element\": \"Co\",\n",
    "                \"mass\": 58.9332\n",
    "            }\n",
    "        ],\n",
    "        \"pair_style\": {\n",
    "            \"type\": \"eam/alloy\"\n",
    "        },\n",
    "        \"pair_coeff\": {\n",
    "            \"term\": [\n",
    "                {\n",
    "                    \"file\": \"file.eam.alloy\"\n",
    "                },\n",
    "                {\n",
    "                    \"symbols\": \"True\"\n",
    "                }\n",
    "            ]\n",
    "        }\n",
    "    }\n",
    "}\"\"\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Load the potential from the record."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "potential_LAMMPS record named EAM-demo--LAMMPS--v1\n"
     ]
    }
   ],
   "source": [
    "potential = lmp.Potential(eam_alloy_json)\n",
    "print(potential)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3. Potential Classes <a id='section3'></a>\n",
    "\n",
    "*Updated version 1.4.0*: atomman.lammps.Potential() now returns a potentials.record.PotentialLAMMPS or a potentials.record.PotentialLAMMPSKIM object.\n",
    "\n",
    "See the potentials package documentation for more details on the [base Record class](https://github.com/lmhale99/potentials/blob/master/doc/5.%20Record%20Classes.html), the [PotentialLAMMPS subclass](https://github.com/lmhale99/potentials/blob/master/doc/5.3.%20LAMMPS%20potentials.html), and the [PotentialLAMMPSKIM subclass](https://github.com/lmhale99/potentials/blob/master/doc/5.4.%20OpenKIM%20models.html).\n",
    "\n",
    "The objects for the loaded potentials have a number of attributes and methods that\n",
    "\n",
    "- Uniquely identify the LAMMPS potential version and the conceptual potential model that it is based on.\n",
    "- Specify the LAMMPS settings to use with the potential.\n",
    "- Define metadata for all unique atom models, i.e. atom type properties.\n",
    "- Dynamically construct LAMMPS command lines for the potential based on the list of model symbols found in an atomic system."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3.1. Potential identifiers and database metadata\n",
    "\n",
    "Each LAMMPS potential is identified according to a potential model, i.e. the concept of the potential, and the implementation, i.e. the version of the parameter file(s). The potential is further characterized with a status that allows for older, less preferred and erroneous implementations to be filtered out.\n",
    "\n",
    "Here are some of the basic identifiers\n",
    "\n",
    "- __potkey__ (*str*) uuid4 hash-key for the potential model, i.e. the published mathematical form.  This is permanent once assigned.\n",
    "- __potid__ (*str*) human-readable unique identifier for the potential model derived from year, author, element model information.  This ideally is permanent, but may change based on updated publication information.\n",
    "- __key__ (*str*) uuid hash-key for the LAMMPS potential implementation, i.e. the specific potential parameter file(s) and/or LAMMPS pair_style/pair_coeff command lines used.  This is permament once assigned.\n",
    "- __id__ (*str*) human-readable identifier for the LAMMPS potential implementation derived from the potid, source and version.  This may change if potid changes.\n",
    "- __status__ (*str*) indicates the current status of the potential implementation\n",
    "    - 'active' = any implementation that is not known to be incorrect or superceded by a newer version. \n",
    "    - 'superceded' = a correctly implemented version that has been replaced by a newer version to address minor issues. \n",
    "    - 'retracted' = an incorrectly implemented version due to either critical errors with the parameterization, file format, or metadata in the associated potential_LAMMPS record. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "potential.potkey -> 820738a9-f556-468b-9041-9d98351ff751\n",
      "potential.potid ->  EAM-demo\n",
      "potential.key ->    a45a7731-d115-4079-b6f5-aa700c5b5c56\n",
      "potential.id ->     EAM-demo--LAMMPS--v1\n",
      "potential.status -> active\n"
     ]
    }
   ],
   "source": [
    "print(\"potential.potkey ->\", potential.potkey)\n",
    "print(\"potential.potid -> \", potential.potid)\n",
    "print(\"potential.key ->   \", potential.key)\n",
    "print(\"potential.id ->    \", potential.id)\n",
    "print(\"potential.status ->\", potential.status)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The string representation of the Potential returns its id."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "potential_LAMMPS record named EAM-demo--LAMMPS--v1\n"
     ]
    }
   ],
   "source": [
    "print(potential)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3.2. LAMMPS settings\n",
    "\n",
    "A number of attributes are used to specify required settings to use with the potentials.\n",
    "\n",
    "- __atom_style__ (*str*) LAMMPS atom_style option for the potential.\n",
    "- __pair_style__ (*str*) LAMMPS pair_style option for the potential.\n",
    "- __units__ (*str*) LAMMPS units option for the potential.\n",
    "- __allsymbols__ (*bool*) flag that indicates if the pair_style requires that pair_coeff be specified for all interaction models even if some models are not actually use"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "potential.pair_style -> eam/alloy\n",
      "potential.atom_style -> atomic\n",
      "potential.units ->      metal\n",
      "potential.allsymbols -> False\n"
     ]
    }
   ],
   "source": [
    "print(\"potential.pair_style ->\", potential.pair_style)\n",
    "print(\"potential.atom_style ->\", potential.atom_style)\n",
    "print(\"potential.units ->     \", potential.units)\n",
    "print(\"potential.allsymbols ->\", potential.allsymbols)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3.3. Atom-type properties\n",
    "\n",
    "Each unique atomic model is associated with a symbol, and that symbol can then be associated with an element, a mass and/or a charge.\n",
    "\n",
    "- __symbols__ (*list*) The symbols used to uniquely identify the different atomic models defined by the potential.\n",
    "- __elements()__ (*list*) Returns the list of elements that correspond to the symbols. If a symbol is not associated with an element, then that symbol's element is given as None.\n",
    "- __masses()__ (*list*) The atomic/particle masses that correspond to the symbols.  For symbols associated with elements, the class will return the standard elemental mass for that element if the mass is not explicitly set elsewhere.\n",
    "- __charges()__ (*list*) The atomic/particle charges that correspond to the symbols.  This is used for potentials that assign constant charges to particles based on their symbols, e.g. Coulumbic potentials.  Charges for potentials with variable charges, e.g. ReaxFF and COMB, should not be set. If no charge is set for a symbol, the charge is assumed to be 0.\n",
    "\n",
    "The elements(), masses(), and charges() methods all take the same parameters\n",
    "\n",
    "- __symbols__ (*str or list, optional*) a list of the potential's symbol models to retrieve values for. If value is None (default) then all values are returned according to the symbols attribute of the class."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Calling the methods without parameters uses all symbols."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "potential.symbols ->    ['Ni', 'Al', 'Co']\n",
      "potential.elements() -> ['Ni', 'Al', 'Co']\n",
      "potential.charges() ->   [0.0, 0.0, 0.0]\n",
      "potential.masses() ->   [58.6934, 26.981539, 58.9332]\n"
     ]
    }
   ],
   "source": [
    "# Calling methods without parameters uses all symbols\n",
    "print(\"potential.symbols ->   \", potential.symbols)\n",
    "print(\"potential.elements() ->\", potential.elements())\n",
    "print(\"potential.charges() ->  \", potential.charges())\n",
    "print(\"potential.masses() ->  \", potential.masses())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Calling the methods with symbols gives values for that particular set."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "potential.elements('Ni') -> ['Ni']\n",
      "potential.charges('Ni') -> [0.0]\n",
      "potential.masses('Ni') -> [58.6934]\n",
      "\n",
      "potential.elements(['Al', 'Al', 'Co', 'Al']) -> ['Al', 'Al', 'Co', 'Al']\n",
      "potential.charges(['Al', 'Al', 'Co', 'Al']) -> [0.0, 0.0, 0.0, 0.0]\n",
      "potential.masses(['Al', 'Al', 'Co', 'Al']) ->   [26.981539, 26.981539, 58.9332, 26.981539]\n",
      "\n"
     ]
    }
   ],
   "source": [
    "# Calling methods with symbols uses that particular set\n",
    "print(\"potential.elements('Ni') ->\", potential.elements('Ni'))\n",
    "print(\"potential.charges('Ni') ->\", potential.charges('Ni'))\n",
    "print(\"potential.masses('Ni') ->\", potential.masses('Ni'))\n",
    "print()\n",
    "\n",
    "print(\"potential.elements(['Al', 'Al', 'Co', 'Al']) ->\", potential.elements(['Al', 'Al', 'Co', 'Al']))\n",
    "print(\"potential.charges(['Al', 'Al', 'Co', 'Al']) ->\", potential.charges(['Al', 'Al', 'Co', 'Al']))\n",
    "print(\"potential.masses(['Al', 'Al', 'Co', 'Al']) ->  \", potential.masses(['Al', 'Al', 'Co', 'Al']))\n",
    "print()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3.4. Generate LAMMPS commands\n",
    "\n",
    "#### 3.4.1. Potential directory\n",
    "\n",
    "For potentials with parameter files, LAMMPS needs to know where the files are in order to read them in. With the Potential class, this is handled with the pot_dir parameter\n",
    "\n",
    "- **pot_dir** (*str or None*) the directory containing files associated with the potential.  If None, then the files are assumed to either be in the working directory or a directory that LAMMPS knows about.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "potential.pot_dir ->   \n"
     ]
    }
   ],
   "source": [
    "print(\"potential.pot_dir ->  \", potential.pot_dir)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Depending on how the potential was loaded, the default value of pot_dir may be different:\n",
    "\n",
    "- If load_lammps_potential() or Database.get_lammps_potential(s) are used, the pot_dir value will depend on the pot_dir_setting.\n",
    "- If the potential is loaded directly from a file, then the default pot_dir value is ''.\n",
    "\n",
    "__NOTE__: The pot_dir attribute can be directly set to a different value at any time after the object has been created."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "potential.pot_dir ->  /demo/new_potential_folder\n"
     ]
    }
   ],
   "source": [
    "potential.pot_dir = '/demo/new_potential_folder'\n",
    "\n",
    "print(\"potential.pot_dir -> \", potential.pot_dir)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 3.4.2. pair_info()\n",
    "\n",
    "The LAMMPS input command lines for using the potential can be autogenerated using the pair_info() method.\n",
    "\n",
    "Parameters\n",
    "\n",
    "- __symbols__ (*str or list, optional*) a list of the potential's symbol models to associate with integer atom types of a system. If value is None (default) then Potential.symbols is used.\n",
    "- __masses__ (*list, optional*) Can be given to override the default symbol-based masses for each atom type.  Must be a list of the same length as symbols.  Any values of None in the list indicate that the default value be used for that atom type.  *Added version 1.3.0*.\n",
    "- __prompt__ (*bool, optional*) If True (default), then a screen prompt will appear asking for the isotope number if no mass is pre-defined for a symbol and the associated element lacks a single standard atomic/ionic mass.  If False, then an error will be raised for these cases instead. *Added version 1.4.0*.\n",
    "- __comments__ (*bool, optional*) Indicates if print command lines detailing information on the potential are to be included.  Default value is True. *Added version 1.4.0*.\n",
    " \n",
    "**NOTE:** For pair_styles hybrid and hybrid/overlay, the list of symbols given as parameters must include all defined atom model interactions."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Without symbols gives LAMMPS commands for all symbols in the same order as the data model."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "potential.pair_info() ->\n",
      "pair_style eam/alloy\n",
      "pair_coeff * * \\demo\\new_potential_folder\\file.eam.alloy Ni Al Co\n",
      "mass 1 58.6934\n",
      "mass 2 26.981539\n",
      "mass 3 58.9332\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print('potential.pair_info() ->')\n",
    "print(potential.pair_info())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Give a list of symbols to dynamically generate commands based on the elements in the associated atomic system."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "potential.pair_info('Ni') ->\n",
      "pair_style eam/alloy\n",
      "pair_coeff * * \\demo\\new_potential_folder\\file.eam.alloy Ni\n",
      "mass 1 58.6934\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(\"potential.pair_info('Ni') ->\")\n",
    "print(potential.pair_info('Ni'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "potential.pair_info(['Al', 'Al', 'Co', 'Al']) ->\n",
      "pair_style eam/alloy\n",
      "pair_coeff * * \\demo\\new_potential_folder\\file.eam.alloy Al Al Co Al\n",
      "mass 1 26.981539\n",
      "mass 2 26.981539\n",
      "mass 3 58.9332\n",
      "mass 4 26.981539\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(\"potential.pair_info(['Al', 'Al', 'Co', 'Al']) ->\")\n",
    "print(potential.pair_info(['Al', 'Al', 'Co', 'Al']))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Specify masses to override default values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "potential.pair_info('Ni', masses=27) ->\n",
      "pair_style eam/alloy\n",
      "pair_coeff * * \\demo\\new_potential_folder\\file.eam.alloy Ni\n",
      "mass 1 27\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(\"potential.pair_info('Ni', masses=27) ->\")\n",
    "print(potential.pair_info('Ni', masses=27))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 3.4.3. System.dump('atom_data')\n",
    "\n",
    "The pair info command lines can also be directly incorporated with the read atom info command lines generated when a System is dumped to a LAMMPS data file by giving the potential to the dump function.  This is highly preferred for writing calculation methods to be agnostic to the potential as it ensures that the data file is compatible with the potential and the command lines are in the proper order. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "units metal\n",
      "atom_style atomic\n",
      "\n",
      "boundary p p p\n",
      "read_data test.dat\n",
      "\n",
      "pair_style eam/alloy\n",
      "pair_coeff * * \\demo\\new_potential_folder\\file.eam.alloy Ni\n",
      "mass 1 58.6934\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "# Define a simple unit cell\n",
    "fcc_test = am.load('prototype', 'A1--Cu--fcc', a=3.52, symbols='Ni')\n",
    "\n",
    "# Dump to data file\n",
    "atom_pair_info = fcc_test.dump('atom_data', f='test.dat', potential=potential)\n",
    "\n",
    "# Check the command lines\n",
    "print(atom_pair_info)\n",
    "\n",
    "# Delete dump file\n",
    "Path('test.dat').unlink()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 4. Building a new potential<a id='section4'></a>\n",
    "\n",
    "*Added version 1.3.4*\n",
    "\n",
    "The function build_lammps_potential() is also inherited from potentials allowing for users to easily build and save their own potential objects.    \n",
    "\n",
    "See the documentation for the [potentials package](https://github.com/usnistgov/potentials) for more details and examples.\n",
    "\n",
    "Parameters for all formats\n",
    "\n",
    "- __pair_style__ (*str*) The LAMMPS pair_style option to use.\n",
    "- __id__ (*str, optional*) A human-readable identifier to name the LAMMPS potential implementation.  Must be set in order to save to the database as the id is used as the potential's file name.\n",
    "- __key__ (*str, optional*) A UUID4 code to uniquely identify the LAMMPS potential implementation.  If not specified, a new UUID4 code is automatically generated.\n",
    "- __potid__ (*str, optional*) A human-readable identifier to refer to the conceptual potential model that the potential is based on.  This should be shared by alternate implementations of the same potential.\n",
    "- __potkey__ (*str, optional*) A UUID4 code to uniquely identify the conceptual potential model. This should be shared by alternate implementations of the same potential. If not specified, a new UUID4 code is automatically generated.\n",
    "- __units__ (*str, optional*) The LAMMPS units option to use.\n",
    "- __atom_style__ (*str, optional*) The LAMMPS atom_style option to use.\n",
    "- __pair_style_terms__ (*list, optional*) Any other terms that appear on the pair_style line (like cutoff) if needed.\n",
    "- __status__ (*str, optional*) Indicates if the implementation is 'active' (valid and current), 'superseded' (valid, but better ones exist), or 'retracted' (invalid). Default value is 'active'.\n",
    "- __allsymbols__ (*bool, optional*) Flag indicating if the coefficient lines must be defined for every particle model in the potential even if those particles are not used.  Default value is False as most pair_styles do not require this.\n",
    "- __elements__ (*str or list, optional*) The elemental symbols associated with each particle model if the particles represent atoms.\n",
    "- __masses__ (*float or list, optional*) The masses of each particle.  Optional if elements is given as standard values can be used.\n",
    "- __charges__ (*float or list, optional*) The static charges to assign to each particle, if the model calls for it.\n",
    "- __symbols__ (*str or list, optional*) The symbols used to identify each unique particle model. Optional if elements is given and the particle symbols are the same as the elemental symbols.\n",
    "- __command_terms__ (*list, optional*) Allows any other LAMMPS command lines that must be set for the potential to work properly to be set.  Each command line should be given as a list of terms, and multiple command lines given as a list of lists.\n",
    "\n",
    "Parameters for true pair potentials, e.g. lj/cut\n",
    "\n",
    "- __interactions__ (*dict or list of dict, optional*) Each unique pair interaction is characterized by a dict containing symbols=two element model symbols, and terms=list of pair_coeff terms.\n",
    "\n",
    "Parameters for potentials with a single parameter file, e.g. eam/alloy\n",
    "\n",
    "- __paramfile__ (*str, optional*) The name of the potential's parameter file.\n",
    "            \n",
    "Parameters for potentials with common library and specific parameter files, e.g. meam and eim\n",
    "\n",
    "- __libfile__ (*str, optional*) The name of the potential's library file.\n",
    "- __paramfile__ (*str, optional*) The name of the potential's parameter file.\n",
    "            \n",
    "Parameters for the original eam style\n",
    "\n",
    "- __paramfiles__ (*str or list, optional*) The name(s) of the potential's parameter file(s).  There should be one parameter file for each element model.\n",
    "\n",
    "\n",
    "__NOTE__: This function currently supports *most but not all* LAMMPS pair_styles. If the function says that the pair_style is unsupported but it has a format similar to one of the listed options, you can call the associated builder class in potentials directly (and let us know it needs to be added to the lists).  If the format is decidedly different (e.g. hybrid), then the underlying information can be manually built as detailed in Section #6 below.  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Initialize a builder for an eam/alloy potential. Note that only the pair style, list of elements and parameter file(s) are needed to use it."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "custom_eam_potential = am.build_lammps_potential(pair_style='eam/alloy', \n",
    "                                                 elements='Ag',\n",
    "                                                 paramfile='Ag-custom.eam.alloy')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Generate a potential object from the builder"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "pair_style eam/alloy\n",
      "pair_coeff * * Ag-custom.eam.alloy Ag\n",
      "mass 1 107.8682\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "potential = custom_eam_potential.potential()\n",
    "\n",
    "print(potential.pair_info())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If an id is also assigned to the potential, then it can be saved to the local database with Database.save_lammps_potentials()."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "custom_eam_potential = am.build_lammps_potential(pair_style='eam/alloy', \n",
    "                                                 id='custom-eam--LAMMPS--v1',\n",
    "                                                 potid='custom-eam',\n",
    "                                                 elements='Ag',\n",
    "                                                 paramfile='Ag-custom.eam.alloy')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 5. potential_LAMMPS Data Model <a id='section5'></a>\n",
    "\n",
    "This section describes the structure of the potential_LAMMPS data model and provides some examples for different LAMMPS pair styles."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 5.1. potential_LAMMPS data model schema <a id='section5'></a>\n",
    "\n",
    "The potential_LAMMPS data model is consistent with a json/xml structure. The root element of the model is __\"potential-LAMMPS\"__.\n",
    "\n",
    "Elements: \n",
    "\n",
    "- __\"key\"__ : a uuid hash-key that uniquely identifies the potential implementation.  Corresponds to the Potential.key attribute.\n",
    "- __\"id\"__ : a human-readable identifier that uniquely identifies the potential implementation.  Corresponds to the Potential.id attribute.\n",
    "- __\"potential\"__ : contains metadata associated with the potential model.\n",
    "- __\"units\"__ : the LAMMPS units option to use with the potential.  Corresponds to the Potential.units attribute.\n",
    "- __\"atom_style\"__ : the LAMMPS atom_style option to use with the potential.  Corresponds to the Potential.atom_style attribute.\n",
    "- __\"allsymbols\"__ : boolean flag that indicates if all of a potential's symbols need to be listed in the pair_coeff lines.  This is required for certain pair_styles.  Assumed to be False if field is missing.\n",
    "- __\"status\"__ : label characterizing the known status of the potential, i.e. \"active\", \"superceded\", or \"retracted\".  This makes it possible to separate old/bad implementations from current ones.  If field is missing, status is assumed to be \"active\".\n",
    "- __\"atom\"__ : provides information relating to the atom-models defined in the potential.\n",
    "- __\"pair_style\"__ : classifies the terms that appear in the LAMMPS pair_style command associated with the potential.\n",
    "- __\"pair_coeff\"__ : classifies the terms that appear in the LAMMPS pair_coeff command associated with the potential.\n",
    "- __\"command\"__ : classifies the terms that appear in any other LAMMPS command associated with the potential."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 5.1.1. The \"potential\" branch <a id='section5.1.1'></a>\n",
    "\n",
    "The __\"potential\"__ branch gives metadata associated with the potential model that the LAMMPS implementation is based on. The potential model is the concept (mathematical expression) of a potential, and multiple implementations of the same potential model may exist. \n",
    "\n",
    "Subelements:\n",
    "\n",
    "- __\"key\"__ : a uuid hash-key that uniquely identifies the potential model.  Corresponds to the Potential.potkey attribute.\n",
    "- __\"id\"__ : a human-readable identifier that uniquely identifies the potential model.   Corresponds to the Potential.potid attribute."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\n",
      "    \"potential\": {\n",
      "        \"key\": <uuid>, \n",
      "        \"id\": <name>\n",
      "    }\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "print(\"\"\"{\n",
    "    \"potential\": {\n",
    "        \"key\": <uuid>, \n",
    "        \"id\": <name>\n",
    "    }\n",
    "}\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 5.1.2. The \"atom\" branch <a id='section5.1.2'></a>\n",
    "\n",
    "The __\"atom\"__ branch of the data model provides a list of the atom-models described by the potential.\n",
    "\n",
    "Subelements:\n",
    "\n",
    "- __\"element\"__: chemical element tag associated with the atom-model. If not given, it is set equal to the __\"symbol\"__ value.\n",
    "- __\"symbol\"__: unique symbol associated with the atom-model. If not given, it is set equal to the __\"element\"__ value.\n",
    "- __\"mass\"__: element mass associated with the element/atom-model. If not given, it is set equal to the standard atomic mass value associated with the element given by __\"element\"__. \n",
    "- __\"charge\"__: ionic charge associated with the atom-model. If not given, it is set to 0.0.  Only needs to be defined for pair_styles where the ionic charge is constant for a given atom-model e.g. Columbic potentials."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\n",
      "    \"atom\": {\n",
      "        \"element\": <element-tag>,\n",
      "        \"symbol\": <atom-model-name>,\n",
      "        \"mass\": <element-mass>,\n",
      "        \"charge\": <ionic-charge>\n",
      "    }\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "# Single-element potentials\n",
    "print(\"\"\"{\n",
    "    \"atom\": {\n",
    "        \"element\": <element-tag>,\n",
    "        \"symbol\": <atom-model-name>,\n",
    "        \"mass\": <element-mass>,\n",
    "        \"charge\": <ionic-charge>\n",
    "    }\n",
    "}\"\"\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\n",
      "    \"atom\": [\n",
      "        {\n",
      "            \"element\": <element-tag>,\n",
      "            \"symbol\": <atom-model-name>,\n",
      "            \"mass\": <element-mass>,\n",
      "            \"charge\": <ionic-charge>\n",
      "        },\n",
      "        {\n",
      "            \"element\": <element-tag>,\n",
      "            \"symbol\": <atom-model-name>,\n",
      "            \"mass\": <element-mass>,\n",
      "            \"charge\": <ionic-charge>\n",
      "        }\n",
      "    ]\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "# Multi-element potentials\n",
    "print(\"\"\"{\n",
    "    \"atom\": [\n",
    "        {\n",
    "            \"element\": <element-tag>,\n",
    "            \"symbol\": <atom-model-name>,\n",
    "            \"mass\": <element-mass>,\n",
    "            \"charge\": <ionic-charge>\n",
    "        },\n",
    "        {\n",
    "            \"element\": <element-tag>,\n",
    "            \"symbol\": <atom-model-name>,\n",
    "            \"mass\": <element-mass>,\n",
    "            \"charge\": <ionic-charge>\n",
    "        }\n",
    "    ]\n",
    "}\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 5.1.3. The \"pair_style\" branch <a id='section5.1.3'></a>\n",
    "\n",
    "The __\"pair_style\"__ branch of the data model characterizes the terms that appear in the LAMMPS pair_style command for the potential.\n",
    "\n",
    "Subelements:\n",
    "\n",
    "- __\"type\"__ : the specific LAMMPS pair_style option for the potential.  Corresponds to the Potential.pair_style attribute.\n",
    "- __\"term\"__ : a list characterizing any additional terms that appear in the pair_style command line. The available subelements are the same as the ones available in the __\"term\"__ branch of __\"pair_coeff\"__.\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\n",
      "    \"pair_style\": {\n",
      "        \"type\": <pair_style-type>,\n",
      "        \"term\": [\n",
      "            {\n",
      "                \"parameter\": <number>\n",
      "            },\n",
      "            {\n",
      "                \"option\": <string>\n",
      "            }\n",
      "        ]\n",
      "    } \n",
      "}\n"
     ]
    }
   ],
   "source": [
    "print(\"\"\"{\n",
    "    \"pair_style\": {\n",
    "        \"type\": <pair_style-type>,\n",
    "        \"term\": [\n",
    "            {\n",
    "                \"parameter\": <number>\n",
    "            },\n",
    "            {\n",
    "                \"option\": <string>\n",
    "            }\n",
    "        ]\n",
    "    } \n",
    "}\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 5.1.4. The \"pair_coeff\" branch <a id='section5.1.4'></a>\n",
    "\n",
    "The __\"pair_coeff\"__ branch of the data model characterizes the terms that appear in the LAMMPS pair_coeff command lines for the potential. Multiple __\"pair_coeff\"__ values can be given.\n",
    "\n",
    "Subelements:\n",
    "\n",
    "- __\"interaction\"__ : an __\"interaction\"__ branch that outlines the atom-model interactions associated with a pair_coeff command line. \n",
    "    - __\"symbol\"__ : a list of the atom-model symbols that the interaction is associated with.\n",
    "- __\"term\"__ : a __\"term\"__ branch that characterizes all the terms that appear in a pair_coeff command line.\n",
    "    - __\"option\"__ : a string option value.\n",
    "    - __\"parameter\"__ : a numerical parameter value.\n",
    "    - __\"file\"__ : a file name. Used by potential styles that read parameters from external files, like eam/alloy. \n",
    "    - __\"symbols\"__ : Boolean indicating to show a list of the atom-model symbols to use. Used by potential styles that read parameters from external potential files, like eam/alloy. \n",
    "    - __\"symbolsList\"__ : Boolean indicating to show a list of the unique atom-model symbols to use.  Don't use!\n",
    "    \n",
    "Different types of pair_styles have slightly different rules with interpreting the __\"pair_coeff\"__ branch.\n",
    "\n",
    "- For two-body style potentials, every unique atom-model pair has its own __\"pair_coeff\"__ element. __\"interaction\"__-__\"symbol\"__ must have two values indicating the atom-model pair, eg. [\"Ag\", \"Ag\"] for the Ag-Ag interaction and [\"Ag\", \"Cu\"] for Ag-Cu and Cu-Ag interactions. __\"interaction\"__ is optional if there is only one pair interaction, i.e. an elemental pair potential.\n",
    "\n",
    "- For many-body style potentials, __\"interaction\"__ is optional as all atom-model interactions are accessed using the same pair_coeff command line.\n",
    "\n",
    "- For hybrid style potentials, __\"interaction\"__-__\"symbol\"__ lists all atom-model symbols associated with the particular sub-style. It will have two values for pair sub-styles, but can be of any length for many-body sub-styles."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\n",
      "    \"pair_coeff\": [\n",
      "        {\n",
      "            \"interaction\": {\n",
      "                \"symbol\": [\n",
      "                    <atom-model-name>,\n",
      "                    <atom-model-name>\n",
      "                ]\n",
      "            }\n",
      "            \"term\": [\n",
      "                {\n",
      "                    \"parameter\": <number>\n",
      "                },\n",
      "                {\n",
      "                    \"parameter\": <number>\n",
      "                },\n",
      "                {\n",
      "                    \"parameter\": <number>\n",
      "                },\n",
      "                {\n",
      "                    \"option\": <string>\n",
      "                }\n",
      "            ]\n",
      "        },\n",
      "        {\n",
      "            \"interaction\": {\n",
      "                \"symbol\": [\n",
      "                    <atom-model-name>,\n",
      "                    <atom-model-name>\n",
      "                ]\n",
      "            }\n",
      "            \"term\": [\n",
      "                {\n",
      "                    \"parameter\": <number>\n",
      "                },\n",
      "                {\n",
      "                    \"parameter\": <number>\n",
      "                },\n",
      "                {\n",
      "                    \"parameter\": <number>\n",
      "                },\n",
      "                {\n",
      "                    \"option\": <string>\n",
      "                }\n",
      "            ]\n",
      "        }        \n",
      "    } \n",
      "}\n"
     ]
    }
   ],
   "source": [
    "# pair_coeff example for two-body style potentials \n",
    "print(\"\"\"{\n",
    "    \"pair_coeff\": [\n",
    "        {\n",
    "            \"interaction\": {\n",
    "                \"symbol\": [\n",
    "                    <atom-model-name>,\n",
    "                    <atom-model-name>\n",
    "                ]\n",
    "            }\n",
    "            \"term\": [\n",
    "                {\n",
    "                    \"parameter\": <number>\n",
    "                },\n",
    "                {\n",
    "                    \"parameter\": <number>\n",
    "                },\n",
    "                {\n",
    "                    \"parameter\": <number>\n",
    "                },\n",
    "                {\n",
    "                    \"option\": <string>\n",
    "                }\n",
    "            ]\n",
    "        },\n",
    "        {\n",
    "            \"interaction\": {\n",
    "                \"symbol\": [\n",
    "                    <atom-model-name>,\n",
    "                    <atom-model-name>\n",
    "                ]\n",
    "            }\n",
    "            \"term\": [\n",
    "                {\n",
    "                    \"parameter\": <number>\n",
    "                },\n",
    "                {\n",
    "                    \"parameter\": <number>\n",
    "                },\n",
    "                {\n",
    "                    \"parameter\": <number>\n",
    "                },\n",
    "                {\n",
    "                    \"option\": <string>\n",
    "                }\n",
    "            ]\n",
    "        }        \n",
    "    } \n",
    "}\"\"\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\n",
      "    \"pair_coeff\": {\n",
      "        \"term\": [\n",
      "            {\n",
      "                \"file\": <file-path>\n",
      "            },\n",
      "            {\n",
      "                \"option\": <string>\n",
      "            },\n",
      "            {\n",
      "                \"file\": <file-path>\n",
      "            },\n",
      "            {\n",
      "                \"symbols\": true\n",
      "            }\n",
      "        ]\n",
      "    } \n",
      "}\n"
     ]
    }
   ],
   "source": [
    "# pair_coeff example for many-body potentials with library and parameter files\n",
    "print(\"\"\"{\n",
    "    \"pair_coeff\": {\n",
    "        \"term\": [\n",
    "            {\n",
    "                \"file\": <file-path>\n",
    "            },\n",
    "            {\n",
    "                \"option\": <string>\n",
    "            },\n",
    "            {\n",
    "                \"file\": <file-path>\n",
    "            },\n",
    "            {\n",
    "                \"symbols\": true\n",
    "            }\n",
    "        ]\n",
    "    } \n",
    "}\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 5.1.5. The \"command\" branch <a id='section5.1.5'></a>\n",
    "\n",
    "The __\"command\"__ branch of the data model characterizes the terms that appear in any other LAMMPS command lines that are required for properly running the potential. This is needed for specifying such things as a fix qeq/comb for COMB potentials.\n",
    "\n",
    "Subelements:\n",
    "\n",
    "- __\"term\"__ : a __\"term\"__ branch that characterizes all the terms that appear in the command line.\n",
    "    - __\"option\"__ : a string option value.\n",
    "    - __\"parameter\"__ : a numerical parameter value.\n",
    "    - __\"file\"__ : a file name.\n",
    "    - __\"symbols\"__ : Boolean indicating to show a list of the atom-model symbols to use. \n",
    "    - __\"symbolsList\"__ : Boolean indicating to show a list of the unique atom-model symbols to use. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\n",
      "    \"command\": {\n",
      "        \"term\": [\n",
      "            {\n",
      "                \"option\": <string>\n",
      "            },\n",
      "            {\n",
      "                \"option\": <string>\n",
      "            },\n",
      "            {\n",
      "                \"parameter\": <number>\n",
      "            },\n",
      "            {\n",
      "                \"parameter\": <number>\n",
      "            }                \n",
      "        ]\n",
      "    }\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "print(\"\"\"{\n",
    "    \"command\": {\n",
    "        \"term\": [\n",
    "            {\n",
    "                \"option\": <string>\n",
    "            },\n",
    "            {\n",
    "                \"option\": <string>\n",
    "            },\n",
    "            {\n",
    "                \"parameter\": <number>\n",
    "            },\n",
    "            {\n",
    "                \"parameter\": <number>\n",
    "            }                \n",
    "        ]\n",
    "    }\n",
    "}\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 5.2. Example data models <a id='section5.2'></a>\n",
    "\n",
    "__WARNING!__ These are not real potentials! They are only meant to provide a demonstration for different potential styles."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 5.2.1. Lennard-Jones and other two-body style potentials <a id='section5.2.1'></a>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\n",
      "    \"potential-LAMMPS\": {\n",
      "        \"key\": \"7102f7ec-3612-4665-ad7e-60de508b5f37\",\n",
      "        \"id\": \"lj_cut-demo--LAMMPS--v1\",\n",
      "        \"potential\": {\n",
      "            \"key\": \"ebf17ffa-a5e7-41c5-8e6d-8e00eb7f5068\",\n",
      "            \"id\": \"lj_cut-demo\"\n",
      "        },\n",
      "        \"units\": \"lj\",\n",
      "        \"atom_style\": \"atomic\",\n",
      "        \"atom\": [\n",
      "            {\n",
      "                \"element\": \"He\"\n",
      "            },\n",
      "            {\n",
      "                \"element\": \"Ar\"\n",
      "            }\n",
      "        ],\n",
      "        \"pair_style\": {\n",
      "            \"type\": \"lj/cut\",\n",
      "            \"term\": {\n",
      "                \"parameter\": 10.0\n",
      "            }\n",
      "        },\n",
      "        \"pair_coeff\": [\n",
      "            {\n",
      "                \"interaction\": {\n",
      "                    \"symbol\": [\n",
      "                        \"He\",\n",
      "                        \"He\"\n",
      "                    ]\n",
      "                },\n",
      "                \"term\": [\n",
      "                    {\n",
      "                        \"parameter\": 1.0\n",
      "                    },\n",
      "                    {\n",
      "                        \"parameter\": 1.0\n",
      "                    }\n",
      "                ]\n",
      "            },\n",
      "            {\n",
      "                \"interaction\": {\n",
      "                    \"symbol\": [\n",
      "                        \"Ar\",\n",
      "                        \"Ar\"\n",
      "                    ]\n",
      "                },\n",
      "                \"term\": [\n",
      "                    {\n",
      "                        \"parameter\": 2.0\n",
      "                    },\n",
      "                    {\n",
      "                        \"parameter\": 2.0\n",
      "                    }\n",
      "                ]\n",
      "            },\n",
      "            {\n",
      "                \"interaction\": {\n",
      "                    \"symbol\": [\n",
      "                        \"He\",\n",
      "                        \"Ar\"\n",
      "                    ]\n",
      "                },\n",
      "                \"term\": [\n",
      "                    {\n",
      "                        \"parameter\": 1.0\n",
      "                    },\n",
      "                    {\n",
      "                        \"parameter\": 2.0\n",
      "                    }\n",
      "                ]\n",
      "            }            \n",
      "        ]\n",
      "    }\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "print(\"\"\"{\n",
    "    \"potential-LAMMPS\": {\n",
    "        \"key\": \"7102f7ec-3612-4665-ad7e-60de508b5f37\",\n",
    "        \"id\": \"lj_cut-demo--LAMMPS--v1\",\n",
    "        \"potential\": {\n",
    "            \"key\": \"ebf17ffa-a5e7-41c5-8e6d-8e00eb7f5068\",\n",
    "            \"id\": \"lj_cut-demo\"\n",
    "        },\n",
    "        \"units\": \"lj\",\n",
    "        \"atom_style\": \"atomic\",\n",
    "        \"atom\": [\n",
    "            {\n",
    "                \"element\": \"He\"\n",
    "            },\n",
    "            {\n",
    "                \"element\": \"Ar\"\n",
    "            }\n",
    "        ],\n",
    "        \"pair_style\": {\n",
    "            \"type\": \"lj/cut\",\n",
    "            \"term\": {\n",
    "                \"parameter\": 10.0\n",
    "            }\n",
    "        },\n",
    "        \"pair_coeff\": [\n",
    "            {\n",
    "                \"interaction\": {\n",
    "                    \"symbol\": [\n",
    "                        \"He\",\n",
    "                        \"He\"\n",
    "                    ]\n",
    "                },\n",
    "                \"term\": [\n",
    "                    {\n",
    "                        \"parameter\": 1.0\n",
    "                    },\n",
    "                    {\n",
    "                        \"parameter\": 1.0\n",
    "                    }\n",
    "                ]\n",
    "            },\n",
    "            {\n",
    "                \"interaction\": {\n",
    "                    \"symbol\": [\n",
    "                        \"Ar\",\n",
    "                        \"Ar\"\n",
    "                    ]\n",
    "                },\n",
    "                \"term\": [\n",
    "                    {\n",
    "                        \"parameter\": 2.0\n",
    "                    },\n",
    "                    {\n",
    "                        \"parameter\": 2.0\n",
    "                    }\n",
    "                ]\n",
    "            },\n",
    "            {\n",
    "                \"interaction\": {\n",
    "                    \"symbol\": [\n",
    "                        \"He\",\n",
    "                        \"Ar\"\n",
    "                    ]\n",
    "                },\n",
    "                \"term\": [\n",
    "                    {\n",
    "                        \"parameter\": 1.0\n",
    "                    },\n",
    "                    {\n",
    "                        \"parameter\": 2.0\n",
    "                    }\n",
    "                ]\n",
    "            }            \n",
    "        ]\n",
    "    }\n",
    "}\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 5.2.2. eam/alloy and other many-body potentials from single parameter files <a id='section5.2.2'></a>\n",
    "\n",
    "**NOTE:** Data models for the original eam pair_style are different (see [Section 5.2.6.](#section5.2.6))!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\n",
      "    \"potential-LAMMPS\": {\n",
      "        \"key\": \"a45a7731-d115-4079-b6f5-aa700c5b5c56\",\n",
      "        \"id\": \"EAM-demo--LAMMPS--v1\",\n",
      "        \"potential\": {\n",
      "            \"key\": \"820738a9-f556-468b-9041-9d98351ff751\",\n",
      "            \"id\": \"EAM-demo\"\n",
      "        },\n",
      "        \"units\": \"metal\",\n",
      "        \"atom_style\": \"atomic\",\n",
      "        \"atom\": [\n",
      "            {\n",
      "                \"element\": \"Ni\",\n",
      "                \"mass\": 58.6934\n",
      "            },\n",
      "            {\n",
      "                \"element\": \"Al\",\n",
      "                \"mass\": 26.981539\n",
      "            },\n",
      "            {\n",
      "                \"element\": \"Co\",\n",
      "                \"mass\": 58.9332\n",
      "            }\n",
      "        ],\n",
      "        \"pair_style\": {\n",
      "            \"type\": \"eam/alloy\"\n",
      "        },\n",
      "        \"pair_coeff\": {\n",
      "            \"term\": [\n",
      "                {\n",
      "                    \"file\": \"file.eam.alloy\"\n",
      "                },\n",
      "                {\n",
      "                    \"symbols\": \"True\"\n",
      "                }\n",
      "            ]\n",
      "        }\n",
      "    }\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "print(\"\"\"{\n",
    "    \"potential-LAMMPS\": {\n",
    "        \"key\": \"a45a7731-d115-4079-b6f5-aa700c5b5c56\",\n",
    "        \"id\": \"EAM-demo--LAMMPS--v1\",\n",
    "        \"potential\": {\n",
    "            \"key\": \"820738a9-f556-468b-9041-9d98351ff751\",\n",
    "            \"id\": \"EAM-demo\"\n",
    "        },\n",
    "        \"units\": \"metal\",\n",
    "        \"atom_style\": \"atomic\",\n",
    "        \"atom\": [\n",
    "            {\n",
    "                \"element\": \"Ni\",\n",
    "                \"mass\": 58.6934\n",
    "            },\n",
    "            {\n",
    "                \"element\": \"Al\",\n",
    "                \"mass\": 26.981539\n",
    "            },\n",
    "            {\n",
    "                \"element\": \"Co\",\n",
    "                \"mass\": 58.9332\n",
    "            }\n",
    "        ],\n",
    "        \"pair_style\": {\n",
    "            \"type\": \"eam/alloy\"\n",
    "        },\n",
    "        \"pair_coeff\": {\n",
    "            \"term\": [\n",
    "                {\n",
    "                    \"file\": \"file.eam.alloy\"\n",
    "                },\n",
    "                {\n",
    "                    \"symbols\": \"True\"\n",
    "                }\n",
    "            ]\n",
    "        }\n",
    "    }\n",
    "}\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 5.2.3. COMB and other potentials requiring additional commands <a id='section5.2.3'></a>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\n",
      "    \"potential-LAMMPS\": {\n",
      "        \"key\": \"c6623d40-a3f2-4b2f-948a-3b277f174116\",\n",
      "        \"id\": \"COMB-demo--LAMMPS--v2\",\n",
      "        \"potential\": {\n",
      "            \"key\": \"5ec2aac4-3dd4-4f5c-afb4-21749577c038\",\n",
      "            \"id\": \"COMB-demo\"\n",
      "        },\n",
      "        \"units\": \"nano\",\n",
      "        \"atom_style\": \"charge\",\n",
      "        \"atom\": [\n",
      "            {\n",
      "                \"element\": \"O\"\n",
      "            },\n",
      "            {\n",
      "                \"element\": \"Cu\"\n",
      "            },\n",
      "            {\n",
      "                \"element\": \"Ni\"\n",
      "            }\n",
      "        ],\n",
      "        \"pair_style\": {\n",
      "            \"type\": \"comb\",\n",
      "            \"term\": {\n",
      "                \"option\": \"polar_off\"\n",
      "            }\n",
      "        },\n",
      "        \"pair_coeff\": {\n",
      "            \"term\": [\n",
      "                {\n",
      "                    \"file\": \"file.comb\"\n",
      "                },\n",
      "                {\n",
      "                    \"symbols\": true\n",
      "                }\n",
      "            ]\n",
      "        },\n",
      "        \"command\": {\n",
      "            \"term\": [\n",
      "                {\n",
      "                    \"option\": \"fix\"\n",
      "                },\n",
      "                {\n",
      "                    \"option\": \"qeq/comb\"\n",
      "                },\n",
      "                {\n",
      "                    \"parameter\": 10\n",
      "                },\n",
      "                {\n",
      "                    \"parameter\": 0.0001\n",
      "                }                \n",
      "            ]\n",
      "        }\n",
      "    }\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "print(\"\"\"{\n",
    "    \"potential-LAMMPS\": {\n",
    "        \"key\": \"c6623d40-a3f2-4b2f-948a-3b277f174116\",\n",
    "        \"id\": \"COMB-demo--LAMMPS--v2\",\n",
    "        \"potential\": {\n",
    "            \"key\": \"5ec2aac4-3dd4-4f5c-afb4-21749577c038\",\n",
    "            \"id\": \"COMB-demo\"\n",
    "        },\n",
    "        \"units\": \"nano\",\n",
    "        \"atom_style\": \"charge\",\n",
    "        \"atom\": [\n",
    "            {\n",
    "                \"element\": \"O\"\n",
    "            },\n",
    "            {\n",
    "                \"element\": \"Cu\"\n",
    "            },\n",
    "            {\n",
    "                \"element\": \"Ni\"\n",
    "            }\n",
    "        ],\n",
    "        \"pair_style\": {\n",
    "            \"type\": \"comb\",\n",
    "            \"term\": {\n",
    "                \"option\": \"polar_off\"\n",
    "            }\n",
    "        },\n",
    "        \"pair_coeff\": {\n",
    "            \"term\": [\n",
    "                {\n",
    "                    \"file\": \"file.comb\"\n",
    "                },\n",
    "                {\n",
    "                    \"symbols\": true\n",
    "                }\n",
    "            ]\n",
    "        },\n",
    "        \"command\": {\n",
    "            \"term\": [\n",
    "                {\n",
    "                    \"option\": \"fix\"\n",
    "                },\n",
    "                {\n",
    "                    \"option\": \"qeq/comb\"\n",
    "                },\n",
    "                {\n",
    "                    \"parameter\": 10\n",
    "                },\n",
    "                {\n",
    "                    \"parameter\": 0.0001\n",
    "                }                \n",
    "            ]\n",
    "        }\n",
    "    }\n",
    "}\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 5.2.4. MEAM and other many-body potentials with library and parameter files <a id='section5.2.4'></a>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\n",
      "    \"potential-LAMMPS\": {\n",
      "        \"key\": \"ac63aa71-808c-47e7-b80b-991a50870f35\",\n",
      "        \"id\": \"MEAM-demo--LAMMPS--v1\",\n",
      "        \"potential\": {\n",
      "            \"key\": \"9546264a-06b8-451a-9920-f8a17cc6917b\",\n",
      "            \"id\": \"MEAM-demo\"\n",
      "        },\n",
      "        \"units\": \"metal\",\n",
      "        \"atom_style\": \"atom\",\n",
      "        \"atom\": [\n",
      "            {\n",
      "                \"element\": \"Cu\",\n",
      "                \"symbol\": \"CuD\"\n",
      "            },\n",
      "            {\n",
      "                \"element\": \"Al\",\n",
      "                \"symbol\": \"AlD\"\n",
      "            },\n",
      "            {\n",
      "                \"element\": \"Fe\",\n",
      "                \"symbol\": \"FeD\"\n",
      "            }\n",
      "        ],\n",
      "        \"pair_style\": {\n",
      "            \"type\": \"meam\"\n",
      "        },\n",
      "        \"pair_coeff\": {\n",
      "            \"term\": [\n",
      "                {\n",
      "                    \"file\": \"library.meam\"\n",
      "                },\n",
      "                {\n",
      "                    \"option\": \"CuD AlD FeD\"\n",
      "                },\n",
      "                {\n",
      "                    \"file\": \"potential.meam\"\n",
      "                },\n",
      "                {\n",
      "                    \"symbols\": true\n",
      "                }\n",
      "            ]\n",
      "        }\n",
      "    }\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "print(\"\"\"{\n",
    "    \"potential-LAMMPS\": {\n",
    "        \"key\": \"ac63aa71-808c-47e7-b80b-991a50870f35\",\n",
    "        \"id\": \"MEAM-demo--LAMMPS--v1\",\n",
    "        \"potential\": {\n",
    "            \"key\": \"9546264a-06b8-451a-9920-f8a17cc6917b\",\n",
    "            \"id\": \"MEAM-demo\"\n",
    "        },\n",
    "        \"units\": \"metal\",\n",
    "        \"atom_style\": \"atom\",\n",
    "        \"atom\": [\n",
    "            {\n",
    "                \"element\": \"Cu\",\n",
    "                \"symbol\": \"CuD\"\n",
    "            },\n",
    "            {\n",
    "                \"element\": \"Al\",\n",
    "                \"symbol\": \"AlD\"\n",
    "            },\n",
    "            {\n",
    "                \"element\": \"Fe\",\n",
    "                \"symbol\": \"FeD\"\n",
    "            }\n",
    "        ],\n",
    "        \"pair_style\": {\n",
    "            \"type\": \"meam\"\n",
    "        },\n",
    "        \"pair_coeff\": {\n",
    "            \"term\": [\n",
    "                {\n",
    "                    \"file\": \"library.meam\"\n",
    "                },\n",
    "                {\n",
    "                    \"option\": \"CuD AlD FeD\"\n",
    "                },\n",
    "                {\n",
    "                    \"file\": \"potential.meam\"\n",
    "                },\n",
    "                {\n",
    "                    \"symbols\": true\n",
    "                }\n",
    "            ]\n",
    "        }\n",
    "    }\n",
    "}\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 5.2.5. hybrid-style potentials <a id='section5.2.5'></a>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\n",
      "    \"potential-LAMMPS\": {\n",
      "        \"key\": \"7687807f-6355-4bef-bdc3-dc0dc944e106\",\n",
      "        \"id\": \"hybrid-demo--LAMMPS--v3\",\n",
      "        \"potential\": {\n",
      "            \"key\": \"14226c15-561c-44d4-96ad-ad51304a3606\",\n",
      "            \"id\": \"hybrid-demo\"\n",
      "        },\n",
      "        \"units\": \"metal\",\n",
      "        \"atom_style\": \"atom\",\n",
      "        \"atom\": [\n",
      "            {\n",
      "                \"element\": \"Cu\"\n",
      "            },\n",
      "            {\n",
      "                \"element\": \"H\"\n",
      "            }\n",
      "        ],\n",
      "        \"pair_style\": {\n",
      "            \"type\": \"hybrid\",\n",
      "            \"term\": [\n",
      "                {\n",
      "                    \"option\": \"eam/alloy\"\n",
      "                },\n",
      "                {\n",
      "                    \"option\": \"lj/cut\"\n",
      "                },\n",
      "                {\n",
      "                    \"parameter\": 5.0\n",
      "                }\n",
      "            ]\n",
      "        },\n",
      "        \"pair_coeff\": [\n",
      "            {\n",
      "                \"interaction\": {\n",
      "                    \"symbol\": [\n",
      "                        \"Cu\"\n",
      "                    ]\n",
      "                },\n",
      "                \"term\": [\n",
      "                    {\n",
      "                        \"option\": \"eam/alloy\"\n",
      "                    },\n",
      "                    {\n",
      "                        \"file\": \"cu.eam.alloy\"\n",
      "                    },\n",
      "                    {\n",
      "                        \"symbols\": true\n",
      "                    }\n",
      "                ]\n",
      "            },\n",
      "            {\n",
      "                \"interaction\": {\n",
      "                    \"symbol\": [\n",
      "                        \"Cu\",\n",
      "                        \"H\"\n",
      "                    ]\n",
      "                },\n",
      "                \"term\": [\n",
      "                    {\n",
      "                        \"option\": \"lj/cut\"\n",
      "                    },\n",
      "                    {\n",
      "                        \"parameter\": 3.5\n",
      "                    },\n",
      "                    {\n",
      "                        \"parameter\": 3.0\n",
      "                    }\n",
      "                ]\n",
      "            },\n",
      "            {\n",
      "                \"interaction\": {\n",
      "                    \"symbol\": [\n",
      "                        \"H\",\n",
      "                        \"H\"\n",
      "                    ]\n",
      "                },\n",
      "                \"term\": [\n",
      "                    {\n",
      "                        \"option\": \"lj/cut\"\n",
      "                    },\n",
      "                    {\n",
      "                        \"parameter\": 1.2\n",
      "                    },\n",
      "                    {\n",
      "                        \"parameter\": 2.4\n",
      "                    }\n",
      "                ]\n",
      "            }\n",
      "        ]\n",
      "    }\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "print(\"\"\"{\n",
    "    \"potential-LAMMPS\": {\n",
    "        \"key\": \"7687807f-6355-4bef-bdc3-dc0dc944e106\",\n",
    "        \"id\": \"hybrid-demo--LAMMPS--v3\",\n",
    "        \"potential\": {\n",
    "            \"key\": \"14226c15-561c-44d4-96ad-ad51304a3606\",\n",
    "            \"id\": \"hybrid-demo\"\n",
    "        },\n",
    "        \"units\": \"metal\",\n",
    "        \"atom_style\": \"atom\",\n",
    "        \"atom\": [\n",
    "            {\n",
    "                \"element\": \"Cu\"\n",
    "            },\n",
    "            {\n",
    "                \"element\": \"H\"\n",
    "            }\n",
    "        ],\n",
    "        \"pair_style\": {\n",
    "            \"type\": \"hybrid\",\n",
    "            \"term\": [\n",
    "                {\n",
    "                    \"option\": \"eam/alloy\"\n",
    "                },\n",
    "                {\n",
    "                    \"option\": \"lj/cut\"\n",
    "                },\n",
    "                {\n",
    "                    \"parameter\": 5.0\n",
    "                }\n",
    "            ]\n",
    "        },\n",
    "        \"pair_coeff\": [\n",
    "            {\n",
    "                \"interaction\": {\n",
    "                    \"symbol\": [\n",
    "                        \"Cu\"\n",
    "                    ]\n",
    "                },\n",
    "                \"term\": [\n",
    "                    {\n",
    "                        \"option\": \"eam/alloy\"\n",
    "                    },\n",
    "                    {\n",
    "                        \"file\": \"cu.eam.alloy\"\n",
    "                    },\n",
    "                    {\n",
    "                        \"symbols\": true\n",
    "                    }\n",
    "                ]\n",
    "            },\n",
    "            {\n",
    "                \"interaction\": {\n",
    "                    \"symbol\": [\n",
    "                        \"Cu\",\n",
    "                        \"H\"\n",
    "                    ]\n",
    "                },\n",
    "                \"term\": [\n",
    "                    {\n",
    "                        \"option\": \"lj/cut\"\n",
    "                    },\n",
    "                    {\n",
    "                        \"parameter\": 3.5\n",
    "                    },\n",
    "                    {\n",
    "                        \"parameter\": 3.0\n",
    "                    }\n",
    "                ]\n",
    "            },\n",
    "            {\n",
    "                \"interaction\": {\n",
    "                    \"symbol\": [\n",
    "                        \"H\",\n",
    "                        \"H\"\n",
    "                    ]\n",
    "                },\n",
    "                \"term\": [\n",
    "                    {\n",
    "                        \"option\": \"lj/cut\"\n",
    "                    },\n",
    "                    {\n",
    "                        \"parameter\": 1.2\n",
    "                    },\n",
    "                    {\n",
    "                        \"parameter\": 2.4\n",
    "                    }\n",
    "                ]\n",
    "            }\n",
    "        ]\n",
    "    }\n",
    "}\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 5.2.6. Original eam pair_style <a id='section5.2.6'></a>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\n",
      "    \"potential-LAMMPS\": {\n",
      "        \"key\": \"3c437986-882f-4e23-bc39-6e12dcdba364\", \n",
      "        \"id\": \"eam-demo--LAMMPS--v2\", \n",
      "        \"potential\": {\n",
      "            \"key\": \"5e92413c-8542-49c4-9608-b91ea5c12701\", \n",
      "            \"id\": \"eam-demo\"\n",
      "        }, \n",
      "        \"units\": \"metal\", \n",
      "        \"atom_style\": \"atomic\", \n",
      "        \"atom\": [\n",
      "            {\n",
      "                \"element\": \"Cu\", \n",
      "                \"mass\": 63.55\n",
      "            }, \n",
      "            {\n",
      "                \"element\": \"Ni\", \n",
      "                \"mass\": 58.71\n",
      "            }\n",
      "        ], \n",
      "        \"pair_style\": {\n",
      "            \"type\": \"eam\"\n",
      "        }, \n",
      "        \"pair_coeff\": [\n",
      "            {\n",
      "                \"interaction\": {\n",
      "                    \"symbol\": [\n",
      "                        \"Cu\", \n",
      "                        \"Cu\"\n",
      "                    ]\n",
      "                }, \n",
      "                \"term\": {\n",
      "                    \"file\": \"Cu.eam\"\n",
      "                }\n",
      "            }, \n",
      "            {\n",
      "                \"interaction\": {\n",
      "                    \"symbol\": [\n",
      "                        \"Ni\", \n",
      "                        \"Ni\"\n",
      "                    ]\n",
      "                }, \n",
      "                \"term\": {\n",
      "                    \"file\": \"Ni.eam\"\n",
      "                }\n",
      "            }\n",
      "        ]\n",
      "    }\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "print(\"\"\"{\n",
    "    \"potential-LAMMPS\": {\n",
    "        \"key\": \"3c437986-882f-4e23-bc39-6e12dcdba364\", \n",
    "        \"id\": \"eam-demo--LAMMPS--v2\", \n",
    "        \"potential\": {\n",
    "            \"key\": \"5e92413c-8542-49c4-9608-b91ea5c12701\", \n",
    "            \"id\": \"eam-demo\"\n",
    "        }, \n",
    "        \"units\": \"metal\", \n",
    "        \"atom_style\": \"atomic\", \n",
    "        \"atom\": [\n",
    "            {\n",
    "                \"element\": \"Cu\", \n",
    "                \"mass\": 63.55\n",
    "            }, \n",
    "            {\n",
    "                \"element\": \"Ni\", \n",
    "                \"mass\": 58.71\n",
    "            }\n",
    "        ], \n",
    "        \"pair_style\": {\n",
    "            \"type\": \"eam\"\n",
    "        }, \n",
    "        \"pair_coeff\": [\n",
    "            {\n",
    "                \"interaction\": {\n",
    "                    \"symbol\": [\n",
    "                        \"Cu\", \n",
    "                        \"Cu\"\n",
    "                    ]\n",
    "                }, \n",
    "                \"term\": {\n",
    "                    \"file\": \"Cu.eam\"\n",
    "                }\n",
    "            }, \n",
    "            {\n",
    "                \"interaction\": {\n",
    "                    \"symbol\": [\n",
    "                        \"Ni\", \n",
    "                        \"Ni\"\n",
    "                    ]\n",
    "                }, \n",
    "                \"term\": {\n",
    "                    \"file\": \"Ni.eam\"\n",
    "                }\n",
    "            }\n",
    "        ]\n",
    "    }\n",
    "}\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 5.2.7 Columbic pair_style"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\n",
      "    \"potential-LAMMPS\": {\n",
      "        \"key\": \"7f013ca0-0358-4721-ba72-790a074b0fd8\",\n",
      "        \"id\": \"coul_long-demo--LAMMPS--v1\",\n",
      "        \"potential\": {\n",
      "            \"key\": \"3b326a65-5cbe-4a6c-862a-aa7203660b27\",\n",
      "            \"id\": \"coul_long-demo\"\n",
      "        },\n",
      "        \"units\": \"metal\",\n",
      "        \"atom_style\": \"charge\",\n",
      "        \"atom\": [\n",
      "            {\n",
      "                \"element\": \"Na\",\n",
      "                \"charge\": 1\n",
      "            },\n",
      "            {\n",
      "                \"element\": \"Cl\",\n",
      "                \"charge\": -1\n",
      "            }\n",
      "        ],\n",
      "        \"pair_style\": {\n",
      "            \"type\": \"coul/long\",\n",
      "            \"term\": {\n",
      "                \"parameter\": 10.0\n",
      "            }\n",
      "        },\n",
      "        \"pair_coeff\": {\n",
      "            \"term\": []        \n",
      "        }\n",
      "    }\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "print(\"\"\"{\n",
    "    \"potential-LAMMPS\": {\n",
    "        \"key\": \"7f013ca0-0358-4721-ba72-790a074b0fd8\",\n",
    "        \"id\": \"coul_long-demo--LAMMPS--v1\",\n",
    "        \"potential\": {\n",
    "            \"key\": \"3b326a65-5cbe-4a6c-862a-aa7203660b27\",\n",
    "            \"id\": \"coul_long-demo\"\n",
    "        },\n",
    "        \"units\": \"metal\",\n",
    "        \"atom_style\": \"charge\",\n",
    "        \"atom\": [\n",
    "            {\n",
    "                \"element\": \"Na\",\n",
    "                \"charge\": 1\n",
    "            },\n",
    "            {\n",
    "                \"element\": \"Cl\",\n",
    "                \"charge\": -1\n",
    "            }\n",
    "        ],\n",
    "        \"pair_style\": {\n",
    "            \"type\": \"coul/long\",\n",
    "            \"term\": {\n",
    "                \"parameter\": 10.0\n",
    "            }\n",
    "        },\n",
    "        \"pair_coeff\": {\n",
    "            \"term\": []        \n",
    "        }\n",
    "    }\n",
    "}\"\"\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
